<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%--
  Created by IntelliJ IDEA.
  User: ASUS
  Date: 2020/9/28
  Time: 19:31
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>愿望池</title>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/css/list.css">
    <!-- 最新版本的 Bootstrap 核心 CSS 文件 -->
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/css/bootstrap.min.css"
          integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
    <script>
        function delContent(id) {
            if (confirm("您确定要删除你的愿望吗？")){
                location.href="${pageContext.request.contextPath}/content/del/"+id;
            }
        }
        function out() {
            if (confirm("您确定要退出许愿吗？")){
                window.location.href='${pageContext.request.contextPath}/user/remove';
            }
        }
    </script>
</head>
<body id="bg">

        <nav class="navbar navbar-default">
            <div class="container-fluid">
                <div class="navbar-header">
                    <a class="navbar-brand" href="#">
                        <img alt="Wish">
                    </a>
            </div>
                <p class="navbar-text">  欢迎${user.userName}来到许愿池</p>
                <button type="button" class="btn btn-primary navbar-btn"
                        onclick="window.location.href='${pageContext.request.contextPath}/content/findAll'">
                    大家的愿望</button>
                <button type="button" class="btn btn-success navbar-btn"
                        onclick="window.location.href='${pageContext.request.contextPath}/pages/main.jsp'">
                我要许愿</button>
                <button type="button" class="btn btn-danger navbar-btn navbar-right"
                        onclick="out()">
                退出</button>
            </div>


        </nav>
<%--内容部分--%>
    <c:forEach items="${contentList}" var="content">

           <div id="box">
                 <p>
                       ${content.content}
                 </p>
                 <p>
                   <button type="button" class="btn btn-danger" onclick="delContent(${content.id})">删除</button>
                 </p>
        </div>
    </c:forEach>


</body>
</html>
